package com.xiangxiangjd.kj.papersstar.bean;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;
import java.util.List;

import com.xiangxiangjd.kj.papersstar.utils.excel.annotation.ExcelField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * <p>
 *
 * </p>
 *
 * @author 肖守凯
 * @since 2021-01-21
 */
@Data
@TableName("topic")
@ApiModel(value = "Topic对象", description = "")
public class Topic extends Model<Topic> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "试题id")
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;


    @ApiModelProperty(value = "问卷id")
    @TableField("questionnaire_id")
    private String questionnaireId;

    @ExcelField(title = "试题标题")
    @ApiModelProperty(value = "试题标题")
    @TableField("topic_title")
    private String topicTitle;

    //自动新增时间
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private String createTime;
    //自动更新时间

    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private String updateTime;


    @ApiModelProperty(value = "0正常  1停用")
    @TableField("del_flag")
    private String delFlag;

    @ApiModelProperty(value = "正确答案id  , 多个正确答案 拆分数组")
    @TableField("answer_id")
    private String answerId;


    @ApiModelProperty(value = "试题类型 /占时未设置 /0未单选题/1调查类型")
    @TableField("topic_type")
    private String topicType;


    //答案
    @TableField(exist = false)
    private List<Answer> answers;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getQuestionnaireId() {
        return questionnaireId;
    }

    public void setQuestionnaireId(String questionnaireId) {
        this.questionnaireId = questionnaireId;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    public String getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(String delFlag) {
        this.delFlag = delFlag;
    }

    public String getAnswerId() {
        return answerId;
    }

    public void setAnswerId(String answerId) {
        this.answerId = answerId;
    }

    public String getTopicType() {
        return topicType;
    }

    public void setTopicType(String topicType) {
        this.topicType = topicType;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "Topic{" +
                "id=" + id +
                ", questionnaireId=" + questionnaireId +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", delFlag=" + delFlag +
                ", answerId=" + answerId +
                ", topicType=" + topicType +
                "}";
    }

    public void addAnswers(Answer answer) {
        this.answers.add(answer);

    }
}
